package main

import (
	"fmt"
	"reflect"
	"time"
)

type User struct {
	Name string
	Age  int
	Id   string `mapper:"_id"`
	AA   string `json:"Score"`
	Time time.Time
}

func main() {
	var user []User
	append(&user)

}
func append(user interface{}) {
	out := reflect.ValueOf(user) //1
	//println(out.Kind()==reflect.Slice)
	valType := out.Type()
	valElemType := valType.Elem()
	sliceType := reflect.SliceOf(valElemType)
	//println(out.CanSet())
	//valSlice := out
	s := reflect.MakeSlice(sliceType, 10, 10)
	val := s.Index(0) //获取其中一个
	structs := make([]reflect.Value, 1, 5)
	structs[0] = val
	type field struct {
		field reflect.StructField
		val   reflect.Value
	}
	//fields := []field{}
	fmt.Println(structs[0])
	//out.Set(valSlice)
	//destSlice := reflect.Indirect(destValue)

	//elem := reflect.New(elemType.Elem())
	//toElem := reflect.ValueOf(elem.Interface())
	//toElem.Elem().FieldByName("Name").SetString("1")
	//fmt.Println(toElem.Elem().Field(0))
	//fmt.Println(toElem.Elem().Field(1))
	//fmt.Println(toElem.Elem().Field(2))
	//fmt.Println(toElem.Elem().Field(3))
	//fmt.Println(toElem.Elem().Field(4))
	//fmt.Println(elem.Field(1))
	//fmt.Println(elem.Field(2))

	//fmt.Println(user)
}
